12#ifndef ROC_CORE_REFCNT_H_
13#define ROC_CORE_REFCNT_H_
33 roc_panic(
"refcnt: reference counter is non-zero in destructor, counter=%d",
46 roc_panic(
"refcnt: attempting to call incref() on freed object");
56 roc_panic(
"refcnt: attempting to call decref() on destroyed object");
58 if (--counter_ == 0) {
59 static_cast<T*
>(
const_cast<RefCnt*
>(
this))->destroy();
Base class for non-copyable objects.
Base class for reference countable objects.
long getref() const
Get reference counter.
void incref() const
Increment reference counter.
void decref() const
Decrement reference counter.
#define roc_panic(...)
Print error message and terminate program gracefully.